#ifndef G_EXCEPTION_INCLUDED
#define G_EXCEPTION_INCLUDED

#include "stdio.h"
#include "stdlib.h"

namespace grace_cpp
{
	namespace rtl
	{
		class Exception
		{
		private:
			int m_code;
			char *m_message;
		public:
			Exception(int code, const char* msg)
			{
				m_code = code;
				if (msg)
				{
					size_t size = strlen(msg);
					m_message = new char[size + 1];
					memcpy(m_message, msg, size + 1);
				}
				else
					m_message = NULL;
			}

			virtual ~Exception()
			{
				if (m_message)
					delete [] m_message;
			}

			inline int GetErrorCode() const 
			{
				return m_code;
			}

			inline const char* GetMessage() const 
			{
				return m_message;
			}
		};
	}
}


#endif